Skip to content

hotload-components branch#25

Open
elmisback wants to merge 4 commits intomainfrom
hotload-components
Open

hotload-components branch#25
elmisback wants to merge 4 commits intomainfrom
hotload-components

Conversation

@elmisback
Copy link
Owner

After being warned about abusing emoji, GPT-5 says:

Summary

This branch introduces hot-loadable annotation UI components to the Magic Markup VS Code extension, along with supporting build tooling and a few related improvements. It operationalizes one of the key ideas from the Codetations paper: making it trivial to add new, dynamic annotation types that live outside the source document but stay synchronized with it.


What this branch does

Hot-loading annotation components

  • Adds a user component discovery and build pipeline to the extension:

    • Uses esbuild and chokidar to compile and watch user-authored React components.
    • Adds a new command “Codetations: Compile User Components” that scans <workspace>/codetations_components/, compiles components into an out/ directory, and hot-loads them into the extension’s UI.
    • Keeps an in-memory registry of discovered components (userComponents) for the webview to use.
  • Provides a minimal example component (codetations_components/CommentComponent.tsx) showing the pattern for creating custom annotation UIs.

  • Updates package.json to include necessary dependencies (esbuild, chokidar, react, react-dom, and type packages).

This enables rapid iteration on new annotation types without touching the extension’s core — a major step toward the workflow described in the Codetations paper.


Safer diff handling

  • Hardens AnnotationTracker.ts by guarding against undefined documents and only diffing when documents truly exist and differ. This reduces runtime errors and improves robustness.

Miscellaneous improvements

  • Adds a placeholder for diff compression (currently untested) to reduce stored diff sizes.
  • Cleans up example directory structure and improves debugging output.

Merge-prep checklist

  • Document the new “Codetations: Compile User Components” command and the <workspace>/codetations_components/ convention in the README.
  • Add a minimal integration test confirming that a sample component compiles, loads, and renders.
  • Ensure esbuild and react dependencies are locked to known-good versions and match between the extension and compiled components.
  • Verify that error handling for component compilation and discovery surfaces in the UI (not just console logs).

TL;DR

This branch adds a hot-loadable React component system for Codetations annotation UIs and improves diff robustness — directly advancing the goal of making external annotations trivial to build, integrate, and evolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants